package com.example.demo.zabbix.request.builder.request;

import com.example.demo.zabbix.request.BaseRequest;

import java.time.Instant;

public abstract class RequestBuilder<T> {
    protected BaseRequest<T> baseRequest = new BaseRequest();
    public RequestBuilder(String method){
        baseRequest.setMethod(method);
        baseRequest.setId(Instant.now().getEpochSecond());
    }
    public RequestBuilder(String method,Long id){
        baseRequest.setMethod(method);
        baseRequest.setId(id);
    }
    public RequestBuilder(String method,String auth){
        baseRequest.setMethod(method);
        baseRequest.setId(Instant.now().getEpochSecond());
        baseRequest.setAuth(auth);
    }
    public RequestBuilder(String method,Long id,String auth){
        baseRequest.setMethod(method);
        baseRequest.setId(id);
        baseRequest.setAuth(auth);
    }
    public Long getId() {
        return baseRequest.getId();
    }
    public RequestBuilder<T> setId(Long id) {
        baseRequest.setId(id);
        return this;
    }
    public String getMethod(){
        return baseRequest.getMethod();
    }
    public RequestBuilder<T> setMethod(String method){
        baseRequest.setMethod(method);
        return this;
    }

    public String getAuth(){
        return baseRequest.getAuth();
    }
    public RequestBuilder<T> setAuth(String auth){
        baseRequest.setAuth(auth);
        return this;
    }
    public T getParams(){
        return baseRequest.getParams();
    }

    public abstract BaseRequest<T> builder();
}
